package com.sikaryofficial.qrcode.constant;

import cn.hutool.core.util.StrUtil;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

/**
 * @author : qinjinyuan
 * @desc : 任务类型枚举
 * @date : 2023/10/31 19:23
 */
@Getter
@AllArgsConstructor
public enum BrandNoEnum {
    SKE_BRAND("SKE", "SKE"),
    SIKARY_BRAND("SIKARY", "SIKARY"),
    MEMERS_BRAND("MEMERS", "MEMERS"),
    VFLY_BRAND("VFLY", "VFLY"),
    COUNTERFEIT_BRAND("COUNTERFEIT", "仿品");
    private final String code;
    private final String desc;

    public static BrandNoEnum getByCode(String code) {
        // 匹配返回正确枚举对象，否则返回默认枚举对象
        return Arrays.stream(BrandNoEnum.values())
                .filter(downloadTaskStatusEnum -> StrUtil.equalsIgnoreCase(code, downloadTaskStatusEnum.getCode()))
                .findFirst().orElse(COUNTERFEIT_BRAND);
    }

}
